﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//you must include System.Threading.Tasks to use async
using System.Threading.Tasks;

namespace Woodlands
{
    public class Staff
    {
        private string staffID, firstName, middleName, lastName, homePhone, mobilePhone, emailUni, emailPersonal,
            line1, line2, city, postcode, status, dob;
        
        public Staff()
            {
                staffID = "";
                firstName = "";
                middleName = "";
                lastName = "";
                homePhone = "";
                mobilePhone = "";
                emailUni = "";
                emailPersonal = "";
                line1 = "";
                line2 = "";
                city = "";
                postcode = "";
                status = "";
                dob = "";
            }
        
        
        public async Task create()
        {
            await Task.Run(() => Database.createStaff(this));
            return;
        }

        public async static Task<Staff> search(string IDin)
        {
            return await Database.getStaff(IDin);
        }
        
        public static string nextID()
        {
            return Database.nextStaffID();
        }


        public static void archive(string staffIDin)
        {
           Database.archiveStaff(staffIDin);
        }

        public static async Task<System.Data.DataTable> search(string searchType, string searchString)
        {
            return await Task<System.Data.DataTable>.Run(() => Database.searchStaff(searchType, searchString));
        }
        
        public string ID
        {
            get { return staffID; }
            set { staffID = value; }
        }

        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }
        
        public string MiddleName
        {
            get { return middleName; }
            set { middleName = value; }
        }

        public string LastName
        {
            get { return lastName; }
            set { lastName = value; }
        }

        public string HomePhone
        {
            get { return homePhone; }
            set { homePhone = value; }
        }

        public string MobilePhone
        {
            get { return mobilePhone; }
            set { mobilePhone = value; }
        }

        public string EmailUni
        {
            get { return emailUni; }
            set { emailUni = value; }
        }

        public string EmailPersonal
        {
            get { return emailPersonal; }
            set { emailPersonal = value; }
        }

        public string Line1
        {
            get { return line1; }
            set { line1 = value; }
        }

        public string Line2
        {
            get { return line2; }
            set { line2 = value; }
        }
        
        public string City
        {
            get { return city; }
            set { city = value; }
        }

        public string Postcode
        {
            get { return postcode; }
            set { postcode = value; }
        }

        public string Status
        {
            get { return status; }
            set { status = value; }
        }

        public string DOB
        {
            get { return dob; }
            set { dob = value; }
        }
    }
}
